package bjut.core.constant;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Author: zhuzhiming
 * @Date: 2022/4/9 20:58
 */
public class RpcConstant {

    public static String HOST_ADDRESS = null;

    static {
        try {
            HOST_ADDRESS = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }

    public static final byte[] MAGIC_NUMBER = {(byte) 'z', (byte) 'r', (byte) 'p', (byte) 'c'};
    public static final byte VERSION = 1;
    public static final int HEAD_LENGTH = 16;

    public static final byte REQUEST_TYPE = 0;
    public static final byte RESPONSE_TYPE = 1;
    public static final byte HEART_REQUEST_TYPE = 2;
    public static final byte HEART_RESPONSE_TYPE = 3;

    public static final int MAX_FRAME_LENGTH = 1024 * 1024 * 16;

    public static final String HEART_REQUEST_DATA = "ping";
    public static final String HEART_RESPONSE_DATA = "pong";



}
